package com.quanyan.club.service;

import com.quanyan.api.APIResponse;
import com.quanyan.assets.response.RespRuleDetail;
import com.quanyan.club.entity.db.TbAASettlementRefundDetail;
import com.quanyan.club.entity.db.TbClubOnlineMemberAccount;
import com.quanyan.club.entity.db.TbClubOnlineMemberAccountStream;
import com.quanyan.club.entity.vo.resp.ClubMemberAccountStreamInfo;
import com.quanyan.orderpay.response.RespPayInfo;

import java.math.BigDecimal;
import java.util.List;

/**
 * @Author Hugo.Wwg
 * @Since 2016-07-06
 *
 * 俱乐部账户相关
 */
public interface ClubAccountService {

    /**
     * 给俱乐部线上账户充值后者扣费
     *
     * @param clubId  俱乐部id
     * @param tradeNo 交易号，订单号，活动编号
     * @param fee     金额
     * @param incr    true 充值，false 扣除
     * @param remark  备注
     */
    APIResponse updateClubOnlineAccountBalance(Integer clubId, Integer activityId, String serialNo, String tradeNo,
                                               BigDecimal fee, String remark, boolean incr, int type);

    /**
     * 增加俱乐部线下账户金额
     */
    APIResponse incrementOfflineClubAccount(Integer clubId, Integer activityId,
                                            BigDecimal fee, String remark);

    /**
     * 获取俱乐部某个成员的账户信息
     */
    TbClubOnlineMemberAccount queryClubMemberAccount(Integer clubId, Integer userId);

    /**
     * 增加或者扣除俱乐部成员线上账户余额
     *
     * @param balanceAmount 抵扣金额
     * @param isAdd         是否添加 true为增加 false为扣除
     */
    ClubMemberAccountStreamInfo addOrDeductionPersonClubAccountBalance(BigDecimal balanceAmount,
                                                                       Integer uid, Integer clubId,
                                                                       boolean isAdd);

    /**
     * 获取个人鸟蛋
     */
    RespRuleDetail getPersonEggsInfo(Integer currentUserId, BigDecimal dealAmount);

    /**
     * 获取可用支付方式
     */
    List<RespPayInfo> getSysPayInfo(String sourceBusinessId);

    /**
     * 记录俱乐部成员线上账户金额变动流水
     */
    void recordPersonClubAccountDeductibleStream(Integer uid,
                                                 Integer activityId,
                                                 String remark,
                                                 byte payId, //支付方式
                                                 Integer clubId,
                                                 ClubMemberAccountStreamInfo streamInfo,
                                                 String orderSystemOrderNo, //订单系统的订单号
                                                 byte type, byte status);

    /**
     * 获取俱乐部成员线上账户金额变动流水
     */
    TbClubOnlineMemberAccountStream getPersonClubAccountStream(Integer uid,
                                                               Integer clubId,
                                                               Integer activityId,
                                                               Integer type);

    /**
     * 更新俱乐部成员线上账户金额变动流水
     */
    boolean updatePersonClubAccountStream(TbClubOnlineMemberAccountStream accountStream);


    /**
     * 删除俱乐部成员线上账户金额变动流水
     */
    boolean deletePersonClubAccountStream(Integer accountStreamId);


    /**
     * AA制活动结算退款明细记录
     */
    boolean recordAASettlementRefundDetail(TbAASettlementRefundDetail refundDetail);

    /**
     * 获取AA活动退款明细对象
     *
     * @param orderNo 业务系统订单号
     */
    TbAASettlementRefundDetail getTbAASettlementRefundDetail(String orderNo, Integer activityId);

    /**
     * 获取单个报名用户的活动订单结算后的AA活动退款
     * @param orderNo
     * @param activityId
     * @param orderUid
     * @return
     */
    TbAASettlementRefundDetail getTbAASettlementRefundDetail(String orderNo,
                                                             Integer activityId, Integer orderUid);

    /**
     * 更新AA活动结算明细状态
     */
    boolean updateTbAASettlementRefundDetailStatus(TbAASettlementRefundDetail refundDetail);
}

